*** Do File for Paper ***

* Figure 1 - Union Membership, 1917 to 2021 *
clear
use "C:\Users\dmac9\Dropbox\Final SSQ Public Attitudes Toward Organized Labor\National Union Membership Data.dta"

twoway line union_pct year

* Figure 2 - Union Approval, 1936 to 2022 *
clear
use "C:\Users\dmac9\Dropbox\Final SSQ Public Attitudes Toward Organized Labor\Gallup Union Approval Survey Data.dta"

twoway line approve disapprove year

* Table 1 - Demographic Correlates of Union Attitudes (Feeling Thermometer), 2020 ANES *
clear
use "C:\Users\dmac9\Dropbox\Final SSQ Public Attitudes Toward Organized Labor\Clean 2020 ANES.dta"

reg FT_Unions i.Union_Status [pweight=V200010b]
outreg2 using tab.tex, dec(3) replace

reg FT_Unions i.Union_Status ///
White Female Millenial_GenZ College Married Homeowner Over_100K Public_Sector Church_Weekly Urban RTW [pweight=V200010b]
outreg2 using tab.tex, dec(3) append

reg FT_Unions i.Union_Status ///
White Female Millenial_GenZ College Married Homeowner Over_100K Public_Sector Church_Weekly Urban RTW Democrat [pweight=V200010b]
outreg2 using tab.tex, dec(3) append

* Table 2 - GSS & VSG Descriptive Statistics *
clear
use "C:\Users\dmac9\Dropbox\Final SSQ Public Attitudes Toward Organized Labor\Clean 2021 GSS.dta"

svyset [pweight=wtssnrps]

svy: tab Strong_Unions if Union_HH==0
svy: tab Strong_Unions if Union_HH==1

svy: tab Strong_Unions

clear
use "C:\Users\dmac9\Dropbox\Final SSQ Public Attitudes Toward Organized Labor\Clean VSG Panel Study 2011 to 2021.dta"

svyset [pweight=weight_genpop_2019Jan]

svy: tab Organize_Jan2019 if Union_HH_Nov2019==0
svy: tab Organize_Jan2019 if Union_HH_Nov2019==1

svy: tab Organize_Jan2019


* Table 3 - Voting Behavior, 1988-2016 *
clear
use "C:\Users\dmac9\Dropbox\Final SSQ Public Attitudes Toward Organized Labor\Clean Cumulative ANES 1948 to 2020.dta"

probit Vote_Dem_President FT_Unions_01 Pid7_01 Ideo7_01 Index_Egal_01 Index_Trad_01 i.State i.Year [pweight=VCF0009z]
outreg2 using tab.tex, dec(3) replace

probit Vote_Dem_President c.FT_Unions_01##c.Union_HH Pid7_01 Ideo7_01 Index_Egal_01 Index_Trad_01 i.State i.Year [pweight=VCF0009z] 
outreg2 using tab.tex, dec(3) append

reg Diff_DPC_minus_RPC FT_Unions_01 Pid7_01 Ideo7_01 Index_Egal_01 Index_Trad_01 i.State i.Year [pweight=VCF0009z]
outreg2 using tab.tex, dec(3) append

reg Diff_DPC_minus_RPC c.FT_Unions_01##c.Union_HH Pid7_01 Ideo7_01 Index_Egal_01 Index_Trad_01 i.State i.Year [pweight=VCF0009z]
outreg2 using tab.tex, dec(3) append

* Figure 3 - Graphs of Voting Behavior *
clear
use "C:\Users\dmac9\Dropbox\Final SSQ Public Attitudes Toward Organized Labor\Clean Cumulative ANES 1948 to 2020.dta"

probit Vote_Dem_President FT_Unions_01 Pid7_01 Ideo7_01 Index_Egal_01 Index_Trad_01 i.State i.Year [pweight=VCF0009z]
margins, at(FT_Unions_01=(0(.1)1))
marginsplot

reg Diff_DPC_minus_RPC FT_Unions_01 Pid7_01 Ideo7_01 Index_Egal_01 Index_Trad_01 i.State i.Year [pweight=VCF0009z]
margins, at(FT_Unions_01=(0(.1)1))
marginsplot
